package com.mv.controller;

import com.mv.pojo.Deal;
import com.mv.service.DealService;
import com.mv.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/mv")
public class DealController {
    @Autowired
    private DealService dealService;
    /*获取所有交易记录信息*/
    @GetMapping("/deal/getDealList")
    public SysResult getDealListByLike(String query,String mode){
        List<Deal> dealList=dealService.getDealList(query,mode);
        return SysResult.success(dealList);
    }
    /*根据会员卡ID获取交易记录*/
    @GetMapping("/deal/getDealListByCardId")
    public SysResult getDealListByCardId(String cardId,String query,String mode){
        List<Deal> dealList=dealService.getDealListByCardId(cardId,query,mode);
        return SysResult.success(dealList);
    }
    /*获取充值记录*/
    @GetMapping("/deal/getRechargeList")
    public SysResult getRechargeList(){
        List<Deal> dealList=dealService.getRechargeList();
        return SysResult.success(dealList);
    }
    /*获取消费记录*/
    @GetMapping("/deal/getConsumeList")
    public SysResult getConsumeList(){
        List<Deal> dealList=dealService.getConsumeList();
        return SysResult.success(dealList);
    }
    /*获取会员卡ID筛选集合*/
    @GetMapping("/deal/getSelectList")
    public SysResult getSelectList(){
        List<Select> selectList=dealService.getSelectList();
        return SysResult.success(selectList);
    }
    /*查询成交率和交易金额比例*/
    @GetMapping("/deal/getRecord")
    public SysResult getRecord(){
        Record record=dealService.getRecord();
        return SysResult.success(record);
    }
    /*查询会员交易率和交易金额比例*/
    @GetMapping("/deal/getUserRecordList")
    public SysResult getUserRecordList(){
        List<UserRecord> userRecordList=dealService.getUserRecordList();
        return SysResult.success(userRecordList);
    }
}
